package com.celan.year2023.month04.day30;

/**
 * @author Celan
 * @ClassName Solution
 * @description: TODO
 * @date 2023/04/30
 * @version: 1.0
 */
class Solution {
    public int[] numMovesStones(int a, int b, int c) {
        //最小值,最大值,中间值
        int min = Math.min(Math.min(a, b), c);
        int max = Math.max(Math.max(a, b), c);
        int mid = a + b + c - min - max;

        int[] res = new int[2];
        //最多两次 => 最小值移到 mid-1 | 最大值移到 mid+1
        res[0] = 2;
        if (max - mid == 1 && mid - min == 1) {
            //无法移动
            res[0] = 0;
        } else if (max - mid <= 2 || mid - min <= 2) {
            res[0] = 1;
        }
        //最大值为最大值和最小值间的空隙(除去中间数)
        res[1] = max - min - 2;
        return res;
    }
}
